home *** CD-ROM | disk | FTP | other *** search
- Path: news.nevada.edu!not-for-mail
- From: morrisd@nevada.edu (DAMON MORRIS)
- Newsgroups: comp.lang.c++
- Subject: Return
- Date: 20 Apr 1996 13:04:43 GMT
- Organization: University of Nevada System Computing Services
- Message-ID: <4landb$345@news.nevada.edu>
- NNTP-Posting-Host: pioneer.nevada.edu
- NNTP-Posting-User: unauthenticated_user
- X-Newsreader: TIN [UNIX 1.3 950520BETA PL0]
-
- I am having a really bad problem with some return statements...
- I declare a function to return an int value then in the function
- I check to see if two strings are equal and if so then I use another
- variable to see what to return...
-
- int charisma(int ability, char *choice)
- {
- if (choice == "Loyalty Base")
- {
- if (ability==10) return 20;
- }
- }
-
- This little program will never work for some reason. When I call it
- like this charisma(10,"Loyalty Base") it always returns some number
- that it shouldn't. The number that is returned is usually between
- 5000-10000. If I wrote the value of choice to the screen before it
- checked to see if it was equal to "Loyalty Base" it always says that
- it is equal to "Loyalty Base", yet it never gets to the second if.
- I have no idea what is the matter...I will send anyone full source if
- needed to fix the problem, but the source is 1000+ lines....
-
-
-